package aurora

import "github.com/aurora-go/aurora-email/email"

func (a *Aurora) loadEmail() {
	if a.config == nil {
		//如果配置文件没有加载成功，将不做任何事情
		return
	}
	EmailCinfig := a.config.GetStringMapString("aurora.email")
	var user, passwd, host string
	if v, b := EmailCinfig["user"]; b {
		if v != "" {
			user = v
		}
	}
	if v, b := EmailCinfig["password"]; b {
		if v != "" {
			passwd = v
		}
	}
	if v, b := EmailCinfig["host"]; b {
		if v != "" {
			host = v
		}
	}
	if user == "" || passwd == "" || host == "" {
		return
	}
	email := email.NewClient(user, passwd, host) //初始化email
	a.component.put("aurora.email", email)
}
